package org.grayrabbit.cloud.core.biz;

import org.grayrabbit.cloud.core.application.BizApplication;
import org.grayrabbit.cloud.core.config.ConfiguratorException;
import org.grayrabbit.cloud.core.module.ModuleException;
import org.grayrabbit.cloud.core.module.NoSuchModuleException;
import org.grayrabbit.cloud.core.rpc.Argument;
import org.grayrabbit.cloud.core.rpc.ChannelFactory;
import org.grayrabbit.cloud.core.rpc.Result;

public class ClientUtility {
	//禁用工具化进行实例会
	private ClientUtility(){
	}
	public static void initialize(BizApplication bizApplication){
		BizUtility.initialize(bizApplication, false);
	}
	public static String getProperty(String category, String name,
			String property) throws ConfiguratorException{
		return BizUtility.getProperty(category, name, property, false);
	}
	/**
	 * 获取当前moudle的依赖moudle名
	 * @param name 当前moudle名
	 * @return 被依赖的moudle名
	 * @throws ConfiguratorException
	 */
	public static String getDepend(String name) throws ConfiguratorException{
		return BizUtility.getProperty("moudle", name, "depend", false);
	}
	public static BizModule getModule(String name) throws NoSuchModuleException
	{
		return BizUtility.getModule(name,false);
	}
	public static void removeModule(String name, BizModule module){
		BizUtility.removeModule(name, module, false);
	}
	
	public static ChannelFactory<Result> getChannelFactory(){
		return BizUtility.getChannelFactory();
	}
	
	public static Result submit(String module, Argument argument) throws NoSuchModuleException, ModuleException{
		return BizUtility.submit(module, argument, false);
	}
}
